package demo1;
import java.util.Arrays;

public class TestComparator {
    public static void main(String[] args) {
        StudentComparator[] s = new StudentComparator[]{new StudentComparator("zhangsan", 12),
                new StudentComparator("lisi", 10),
                new StudentComparator("wangwu", 8)};

        NameComparator nameComparator = new NameComparator();
        Arrays.sort(s, nameComparator);
        System.out.println(Arrays.toString(s));

        System.out.println("==========");

        AgeComparator ageComparator = new AgeComparator();
        Arrays.sort(s, ageComparator);
        System.out.println(Arrays.toString(s));
    }
}
